<?php

/**
 * Radcodes - SocialEngine Module
 *
 * @category   Application_Extensions
 * @package    Education
 * @copyright  Copyright (c) 2009-2010 Radcodes LLC (http://www.radcodes.com)
 * @license    http://www.radcodes.com/license/
 * @version    $Id$
 * @author     Vincent Van <vincent@radcodes.com>
 */
 
class Education_Widget_FeaturedEducationController extends Engine_Content_Widget_Abstract
{

  public function indexAction()
  {
  	
    // Don't render this if not authorized
    $viewer = Engine_Api::_()->user()->getViewer();

    $params = array(
      'featured' => 1,
      'order' => 'random',
      'limit' => $this->_getParam('max', 5),
    );
        
    $this->view->paginator = $paginator = Engine_Api::_()->education()->getEducationsPaginator($params);
    
    if ($paginator->getTotalItemCount() == 0) {
      return $this->setNoRender();
    }
    
    $this->view->showphoto = $this->_getParam('showphoto', 1);
    $this->view->showdetails = $this->_getParam('showdetails', 1); 
    
    $this->view->showmeta = $this->_getParam('showmeta', 1); 
    $this->view->showdescription = 0; //$this->_getParam('showdescription', 0);     
    
    $this->view->widget_name = 'education_featurededucations_'.$this->getElement()->getIdentity();
    $this->view->use_slideshow = $paginator->getTotalItemCount() > 1;    
    
  }

}